package com.scholarship.modules.admin.mapper;

import com.scholarship.modules.admin.entity.RewardApplication;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * t_reward_application
 * @Author Z.J.H
 * @create 2021/9/5 15:05
 */
@Repository
public interface ARewardApplicationMapper {
    /**
     * 插入或更新用户奖项得分信息
     * @param rewardApplication
     * @return
     */
    int insertAndUpdateRewardApplication(@Param("user") RewardApplication rewardApplication);

    /**
     * 批量插入和更新用户奖项得分信息
     *
     * @param rewardApplicationList
     * @return
     * @throws Exception
     */
    int insertAndUpdateRewardApplicationList(List<RewardApplication> rewardApplicationList) throws Exception;

    /**
     * 删除用户奖项得分信息
     * @param rewardApplication
     * @return
     */
    int deleteRewardApplication(@Param("user") RewardApplication rewardApplication);

    /**
     * 根据学号删除用户得分信息
     * @param userId
     * @return
     */
    int deleteRewardApplicationByUserId(@Param("userId") String userId);

    /**
     * 通过学生id、奖项id和当前年份查询用户奖项得分信息
     * @param userId
     * @param tableId
     * @param year
     * @return
     */
    RewardApplication getRewardApplicationByUserId(@Param("userId") String userId, @Param("tableId") Integer tableId, @Param("year") String year);
}
